From c27ddc66c573ae897945155e3ef6e1b64d630fba Mon Sep 17 00:00:00 2001 From: Jonh Wendell Date: Thu, 20 Jun 2013 14:39:28 -0300 Subject: [PATCH] GtkEntry: ellipsize placeholder text The placeholder string is truncated when there's no room for it in entry's width. So, by ellipsizing it, the user can notice the text was truncated so that they can workaround that by, for example, maximizing the window. https://bugzilla.gnome.org/show_bug.cgi?id=702763 --- gtk/gtkentry.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 8158c81680..c4e601326a 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -5987,6 +5987,7 @@ gtk_entry_create_layout (GtkEntry *entry, attr->start_index = 0; attr->end_index = G_MAXINT; pango_attr_list_insert (tmp_attrs, attr); + pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END); } if (preedit_length) @@ -6127,6 +6128,9 @@ draw_text_with_color (GtkEntry *entry, get_layout_position (entry, &x, &y); + if (show_placeholder_text (entry)) + pango_layout_set_width (layout, PANGO_SCALE * gdk_window_get_width (entry->priv->text_area)); + cairo_move_to (cr, x, y); gdk_cairo_set_source_rgba (cr, default_color); pango_cairo_show_layout (cr, layout); -- 2.30.2